package br.com.remedioCerto.model;

import java.io.ByteArrayOutputStream;
import java.io.Serializable;
import java.util.List;

import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;

public class Remedio implements Serializable{
	
	private static final long serialVersionUID = -601627965546235307L;

	private Long id;
	
	private String nome;
	
	private byte[] foto;
	
	private  List<Estoque> listaEstoque;
	
	
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	public byte[] getFoto() {
		return foto;
	}
	public void setFoto(byte[] foto) {
		this.foto = foto;
	}
	
	
	public Bitmap getFotoBitmap() {
		return foto==null? null : BitmapFactory.decodeByteArray(foto, 0, foto.length);
	}
	
	public void setFotoBitmap(Bitmap bit) {
		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		bit.compress(CompressFormat.PNG, 0, stream);
		this.foto = stream.toByteArray();
	}

	@Override
	public String toString() {
	return nome;	}
	public List<Estoque> getListaEstoque() {
		return listaEstoque;
	}
	public void setListaEstoque(List<Estoque> listaEstoque) {
		this.listaEstoque = listaEstoque;
	}
}
